Skip to content

Regenerate ERD as a colour-coded SVG with a generator script - #2174

Draft
ArturWieczorek wants to merge 1 commit into
masterfrom
artur/regenerate-erd-svg
Draft

Regenerate ERD as a colour-coded SVG with a generator script#2174
ArturWieczorek wants to merge 1 commit into
masterfrom
artur/regenerate-erd-svg

Conversation

@ArturWieczorek

Copy link
Copy Markdown
Contributor

Fix #1204

The committed doc/ERD.png was a ~1.9 MB binary last updated in 2022 (before Conway and the Hasql rewrite), and its generation was never documented, so it bloated the repo on every update and went stale. Replace it with a diffable SVG plus a script anyone can run to regenerate it.

  • doc/ERD.svg: the current schema as one colour-coded map (tables grouped by subsystem, PK/FK marked, crow's-foot relationships, legend), ~320 KB vector instead of a 1.9 MB PNG.
  • scripts/generate-erd.sh: builds a throwaway database, applies every migration, reads tables/columns/PKs, takes the FK relationships from the migration SQL (the constraints are dropped at run time for insert speed), and renders the SVG.
  • scripts/gen-erd.py: the graphviz generator (domain colours, PK/FK, crow's feet).
  • flake.nix: add graphviz and python3 to the dev shell.
  • Readme.md: point the ERD link at the SVG and note how to regenerate.

Description

Add your description here, if it fixes a particular issue please provide a link to the issue.

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu on version 0.17.0.0 (which can be run with scripts/fourmolize.sh)
  • Self-reviewed the diff

Migrations

  • The pr causes a breaking change of type a,b or c
  • If there is a breaking change, the pr includes a database migration and/or a fix process for old values, so that upgrade is possible
  • Resyncing and running the migrations provided will result in the same database semantically

If there is a breaking change, especially a big one, please add a justification here. Please elaborate
more what the migration achieves, what it cannot achieve or why a migration is not possible.

…pt (#1204)

The committed doc/ERD.png was a ~1.9 MB binary last updated in 2022 (before Conway and the Hasql rewrite), and its generation was never documented, so it bloated the repo on every update and went stale. Replace it with a diffable SVG plus a script anyone can run to regenerate it.

- doc/ERD.svg: the current schema as one colour-coded map (tables grouped by subsystem, PK/FK marked, crow's-foot relationships, legend), ~320 KB vector instead of a 1.9 MB PNG.
- scripts/generate-erd.sh: builds a throwaway database, applies every migration, reads tables/columns/PKs, takes the FK relationships from the migration SQL (the constraints are dropped at run time for insert speed), and renders the SVG.
- scripts/gen-erd.py: the graphviz generator (domain colours, PK/FK, crow's feet).
- flake.nix: add graphviz and python3 to the dev shell.
- Readme.md: point the ERD link at the SVG and note how to regenerate.
@ArturWieczorek ArturWieczorek changed the title docs(erd): regenerate ERD as a colour-coded SVG with a generator scri… Regenerate ERD as a colour-coded SVG with a generator scri… Aug 10, 2026
@ArturWieczorek ArturWieczorek changed the title Regenerate ERD as a colour-coded SVG with a generator scri… Regenerate ERD as a colour-coded SVG with a generator script Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find a better way to store the ERD diagram and document its generation

1 participant